export default {
  title: {
    text: '进店分析',
    left: 'center'
  },
  tooltip: {
    trigger: 'axis',
    formatter (params) {
      let res = ''
      for (let i = 0; i <= params.length - 1; i++) {
        let value
        let color = params[i].color
        let seriesName = params[i]['seriesName']
        if (seriesName === '经过人数') {
          value = params[i].value + '人'
        } else if (seriesName === '进店转化率') {
          value = params[i].value.toFixed(2) + '%'
        }
        res += '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' + color + '"></span>' +
          seriesName + ': ' + value + '</br>'
      }
      res = params[0]['axisValue'] + '</br>' + res
      return res
    }
  },
  legend: {
    data: ['经过人数', '进店转化率'],
    bottom: 0
  },
  grid: {
    left: '3%',
    right: '1%',
    // bottom: '3%',
    containLabel: true
  },
  toolbox: {
    feature: {
      saveAsImage: {}
    }
  },
  xAxis: [
    {
      type: 'category',
      boundaryGap: true,
      axisTick: {
        alignWithLabel: true,
        interval: 0
      }
    }
  ],
  yAxis: [
    {
      type: 'value',
      name: '经过人数(人)',
      minInterval: 1,
      // splitLine: { show: false },
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      }
    },
    {
      type: 'value',
      name: '进店转化率',
      splitLine: { show: false },
      axisLabel: {
        formatter: '{value}%'
      },
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      }
    }
  ],
  series: [
    {
      name: '经过人数',
      type: 'bar',
      barWidth: 25
    },
    {
      name: '进店转化率',
      type: 'line',
      yAxisIndex: 1
    }
  ]
}
